#include "DTOFlightControler.h"

DTOFlightControler::DTOFlightControler(std::string& aDeserealizar): DTO(FLIGHT_CONTROLER) {
	deserializar(aDeserealizar);
}

DTOFlightControler::DTOFlightControler(bool terminate,unsigned int controllerId) : DTO(FLIGHT_CONTROLER){
	this->terminate = terminate;
	this->controllerId = controllerId;
}

DTOFlightControler::~DTOFlightControler() {
}

std::string DTOFlightControler::serializar(){
	std::stringstream retorno;

	retorno << DTO::serializar();
	retorno << UtilString::intToString(this->terminate);
	retorno << PLANO_SEPARATOR;
	retorno << UtilString::intToString(this->controllerId);

	return (retorno.str());
}
bool DTOFlightControler::isTerminate(){
	return (this->terminate);
}

void DTOFlightControler::deserializar(std::string& string){
	std::vector<std::string> valores;
	UtilString::splitWithSeparator(&valores,string,PLANO_SEPARATOR);

	this->terminate = (bool)UtilString::stringToInt(valores[1]);
	this->controllerId= UtilString::stringToInt(valores[2]);
}

unsigned int DTOFlightControler::getControllerId(){
	return controllerId;
}
